import {createStore} from "vuex";
import qi_cart from './modules/cart.js'
import qi_home from './modules/home.js'
export default createStore({
	state: {
	token: uni.getStorageSync('token') ||'',
	active:uni.getStorageSync('active') || 0 ,
	vuex_user:uni.getStorageSync('user') || ''
	},
	mutations: {
		userInfo(state, token) {
			state.token = token
			this.commit('setToken', token)
		},
		setToken(state){
			uni.setStorageSync('token',state.token)
		},
		myuser(state,user){
		state.vuex_user = user
			this.commit('setuser', user)
		},
		setuser(state){
				uni.setStorageSync('user',state.vuex_user)
		},
		// setactive(state,index){
		// 	state.active = index
		// 		this.commit('setActive', index)
		// },
		// setActive(state){
		// 	uni.setStorageSync('token', state.token)
		// }
	},
	actions: {
		
	},
	getters: {
		
	},
	modules: {
		qi_cart,
		qi_home
	}
});